package com.loanly.util;
 
import java.util.Map;

import com.loanly.controller.SummaryManager;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
 
public class LoginAction extends ActionSupport {
/**
	 * 
	 */
	private static final long serialVersionUID = 5440983946013594048L;
	//public class LoginAction {
    /**
	 * 
	 */
//	private static final long serialVersionUID = 1L;
	private String username;
    private String password;
    private SummaryManager summaryManager;
    private Double sumAmount;
    public LoginAction() {
    	summaryManager = new SummaryManager();
    }
 
    
    public String execute() {
 
        if (this.username.equals("admin") 
                && this.password.equals("admin")) {
        	
            Map attibutes = ActionContext.getContext().getSession(); 
            attibutes.put("username", this.username);
        	//this.setSumAmount(summaryManager.getSumAmount());
            
            
            return "success";
        } else {
            addActionError(getText("error.login"));
            return "error";
        }
    }
 
    public String getUsername() {
        return username;
    }
 
    public void setUsername(String username) {
        this.username = username;
    }
 
    public String getPassword() {
        return password;
    }
 
    public void setPassword(String password) {
        this.password = password;
    }

	public Double getSumAmount() {
		return sumAmount;
	}

	public void setSumAmount(Double sumAmount) {
		this.sumAmount = sumAmount;
	}
}